namespace mgp.ads {

    export function hmsFormat(timeStamp: number) {
        let nd = new Date(timeStamp);

        let hh = nd.getHours();
        let mm = nd.getMinutes();
        let ss = nd.getSeconds();
        return `${hh}:${mm}:${ss}`;
    }

    export function timerOnce(delay: number, caller: any, method: Function, args?: Array<any>, coverBefore?: boolean, coverTimeKey?: number): number {
        if (coverBefore && coverTimeKey ) {
            clearTimeout(coverTimeKey);
        }
        args = args || [];
        let t = setTimeout(method.bind(caller), delay, ...args);
        debugLog('开始单次延迟, id:', t)
        return t;
    }
}